Actually load the image handler when we determine the image type.
authorMichael Fulbright <drmike@redhat.com>
Fri, 29 Oct 1999 19:27:51 +0000 (19:27 +0000)
committerMichael Fulbright <drmike@src.gnome.org>
Fri, 29 Oct 1999 19:27:51 +0000 (19:27 +0000)
1999-10-29  Michael Fulbright  <drmike@redhat.com>

        * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Actually
        load the image handler when we determine the image type.

        * src/gdk-pixbuf-io.[ch] (gdk_pixbuf_load_module): Changed the
        previously static function load_image_handler () to
        a public function gdk_pixbuf_load_module (). It is needed in
        gdk-pixbuf-loader.c to load image handler modules.  This function
        is different from gdk_pixbuf_get_module (), which only returns
        a reference to the required handler, because it actually loads
        the handler into memory. Both actions should possibly be combined
        in a convenience function since one w/o the other doesn't seem to
        make much sense.

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-io.c
gdk-pixbuf/gdk-pixbuf-io.h
gdk-pixbuf/gdk-pixbuf-loader.c
gtk/gdk-pixbuf-loader.c

index ec22354fcb4c088298588dea18bf57dbe984abaf..694aa663e0115845e3f41885c770dbc48ba22f6d 100644 (file)
@@ -1,3 +1,18 @@
+1999-10-29  Michael Fulbright  <drmike@redhat.com>
+
+       * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Actually
+       load the image handler when we determine the image type.
+
+       * src/gdk-pixbuf-io.[ch] (gdk_pixbuf_load_module): Changed the
+       previously static function load_image_handler () to
+       a public function gdk_pixbuf_load_module (). It is needed in
+       gdk-pixbuf-loader.c to load image handler modules.  This function
+       is different from gdk_pixbuf_get_module (), which only returns
+       a reference to the required handler, because it actually loads
+       the handler into memory. Both actions should possibly be combined
+       in a convenience function since one w/o the other doesn't seem to
+       make much sense.
+
 1999-10-28  Federico Mena Quintero  <federico@redhat.com>
 
        * src/gdk-pixbuf-render.c (gdk_pixbuf_render_to_drawable): New
index 16c8049e5398abd06b89dfbd498bbd63dafba487..e2b692f6d9360476ced9e5e11ae4a00ac0f44ef8 100644 (file)
@@ -149,8 +149,12 @@ GdkPixbufModule file_formats [] = {
        { NULL, NULL, NULL, NULL, NULL, NULL, NULL }
 };
 
-static void
-image_handler_load (GdkPixbufModule *image_module)
+
+/* actually load the image handler - gdk_pixbuf_get_module only get a */
+/* reference to the module to load, it doesn't actually load it       */
+/* perhaps these actions should be combined in one function           */
+void
+gdk_pixbuf_load_module (GdkPixbufModule *image_module)
 {
        char *module_name;
        char *path;
@@ -240,7 +244,7 @@ gdk_pixbuf_new_from_file (const char *filename)
        image_module = gdk_pixbuf_get_module (buffer, size);
        if (image_module){
                if (image_module->module == NULL)
-                       image_handler_load (image_module);
+                       gdk_pixbuf_load_module (image_module);
 
                if (image_module->load == NULL) {
                        fclose (f);
@@ -270,7 +274,7 @@ gdk_pixbuf_new_from_xpm_data (const gchar **data)
         GdkPixbuf *pixbuf;
 
         if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
-                image_handler_load(&file_formats[XPM_FILE_FORMAT_INDEX]);
+                gdk_pixbuf_load_module(&file_formats[XPM_FILE_FORMAT_INDEX]);
         }
 
         if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
index 4486adfb66c672593e89c53b552227bd90be0c73..2fcd092573f55fe8f53e1dc55247e7f61d11e2e8 100644 (file)
@@ -6,6 +6,7 @@
  *          Miguel de Icaza <miguel@gnu.org>
  *          Federico Mena-Quintero <federico@gimp.org>
  *          Jonathan Blandford <jrb@redhat.com>
+ *          Michael Fulbright <drmike@redhat.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -46,4 +47,5 @@ struct _GdkPixbufModule {
 
 
 GdkPixbufModule *gdk_pixbuf_get_module (gchar *buffer, gint size);
+void gdk_pixbuf_load_module (GdkPixbufModule *image_module);
 
index db734ef63199cd954fb89ad38041e6ea55b5571f..ddb4ad3eec34e3ccc8ca53917a8bb41e3e72b8ff 100644 (file)
@@ -270,16 +270,19 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, guchar *buf, size_t count)
                        priv->image_module = gdk_pixbuf_get_module (priv->buf, 128);
                        if (priv->image_module == NULL)
                                return FALSE;
-                       else if ((priv->image_module->begin_load == NULL) ||
-                                (priv->image_module->stop_load == NULL) ||
-                                (priv->image_module->load_increment == NULL)) {
+                       else if (priv->image_module->module == NULL)
+                               gdk_pixbuf_load_module (priv->image_module);
+
+                       if ((priv->image_module->begin_load == NULL) ||
+                           (priv->image_module->stop_load == NULL) ||
+                           (priv->image_module->load_increment == NULL)) {
                                g_warning ("module %s does not support incremental loading.\n",
                                           priv->image_module->module_name);
                                return FALSE;
                        } else {
                                priv->context = (*priv->image_module->begin_load) (
                                        gdk_pixbuf_loader_prepare, loader);
-
+                               
                                 if (priv->context == NULL) {
                                         g_warning("Failed to begin progressive load");
                                         return FALSE;
index db734ef63199cd954fb89ad38041e6ea55b5571f..ddb4ad3eec34e3ccc8ca53917a8bb41e3e72b8ff 100644 (file)
@@ -270,16 +270,19 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, guchar *buf, size_t count)
                        priv->image_module = gdk_pixbuf_get_module (priv->buf, 128);
                        if (priv->image_module == NULL)
                                return FALSE;
-                       else if ((priv->image_module->begin_load == NULL) ||
-                                (priv->image_module->stop_load == NULL) ||
-                                (priv->image_module->load_increment == NULL)) {
+                       else if (priv->image_module->module == NULL)
+                               gdk_pixbuf_load_module (priv->image_module);
+
+                       if ((priv->image_module->begin_load == NULL) ||
+                           (priv->image_module->stop_load == NULL) ||
+                           (priv->image_module->load_increment == NULL)) {
                                g_warning ("module %s does not support incremental loading.\n",
                                           priv->image_module->module_name);
                                return FALSE;
                        } else {
                                priv->context = (*priv->image_module->begin_load) (
                                        gdk_pixbuf_loader_prepare, loader);
-
+                               
                                 if (priv->context == NULL) {
                                         g_warning("Failed to begin progressive load");
                                         return FALSE;